import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/less/index.less'

import router from './router'
import store from './store'
import axios from 'axios'
// import "./api/mock"

Vue.config.productionTip = false

Vue.use(ElementUI)
Vue.prototype.$axios = axios

// router.beforeEach((to, from, next) => {
//   store.commit('getToken')
//   const token = store.state.User.token
//   if (!token && to.name !== 'login') {
//     next({ name: 'login' })
//   }else {
//     next()
//   }
// })

// 导航守卫,koten或cookie验证
// router.beforeEach((to, from, next) => {
//   store.commit('getToken')
//   const token = store.state.userToken.token
//   console.log("token:" + token);
//   if (!token && to.name !== 'login') {
//     next({ name: 'login' })
//   }else {
//     next()
//   }
// })
new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')
